honor webhook http 422 as unconditional deny#4703
Merged
JAORMX merged 1 commit intostacklok:mainfrom Apr 12, 2026
Merged
Conversation
JAORMX
approved these changes
Apr 9, 2026
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #4703 +/- ##
==========================================
- Coverage 68.84% 68.82% -0.02%
==========================================
Files 516 516
Lines 54314 54326 +12
==========================================
Hits 37391 37391
- Misses 14063 14071 +8
- Partials 2860 2864 +4 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Signed-off-by: Sanskarzz <sanskar.gur@gmail.com>
34e81b4 to
07f2f4c
Compare
JAORMX
approved these changes
Apr 12, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR fixes webhook HTTP 422 handling to match RFC THV-0017.
Both validating and mutating webhook middleware now treat an HTTP 422 response from a webhook as an unconditional deny, regardless of whether the webhook
failure_policyisfailorignore.Fixes #4663
Changes
pkg/webhook/errors.goto detect webhook errors that must always deny.pkg/webhook/validating/middleware.goto deny on webhook HTTP 422 before applying failure policy.pkg/webhook/mutating/middleware.goto deny on webhook HTTP 422 before applying failure policy.failandignorepolicies.Why
Per RFC THV-0017, webhook HTTP 422 is a semantic rejection and should not be treated like a normal operational error. Previously,
failure_policy: ignorecould allow the request to continue even when the webhook returned 422.Test plan
task test)task test-e2e)task lint-fix)